<?php

namespace App\Service\Friend;

use App\Constants\ErrorCode;
use App\Model\Friend\SlideOp;
// use App\Model\UserProfile;
use App\Service\BaseService;

/**
 * 左右滑动态卡
 */
class SlideOpService extends BaseService
{
    public function handle()
    {
        $userId = $this->getUserId();
        //操作: 左滑右滑
        $op = intval($this->request->input('op', 0));
        $momentId = $this->request->input('moment_id', 0);
        $momentUserId = $this->request->input('moment_user_id', 0);
        //添加记录
        $result = SlideOp::addRecord($userId, $op, $momentId, $momentUserId);
        if (!$result) return $this->setError(ErrorCode::SERVER_ERROR, '操作错误, 请稍后再试~');
        return [
            'result' => 1
        ];
    }
}
